Computer system and network interface supporting class of service queues

ABSTRACT

A data processing system adapted for high-speed network communications, a method for managing a network interface and a network interface for such system, are provided, in which processing of packets received over the network is achieved by embedded logic at the network interface level. Incoming packets on the network interface are parsed and classified as they are stored in a buffer memory. Functional logic coupled to the buffer memory on the network interface is enabled to access any data field within a packet in a single cycle, using pointers and packet classification information produced by the parsing and classifying step. Results of operations on the data fields in the packets are available before the packets are transferred out of the buffer memory. A data processing system, a method for management of a network interface and a network interface are also provided by the present invention that include an embedded firewall at the network interface level of the system, which protects against inside and outside attacks on the security of data processing system. Furthermore, a data processing system, a method for management of a network interface and a network interface are a provided by the present invention that support class of service management for packets incoming from the network, by applying priority rules at the network interface level of the system.

REFERENCE TO RELATED APPLICATIONS

The present application is related to copending U.S. Pat. No. 10/______entitled COMPUTER SYSTEM AND NETWORK INTERFACE WITH HARDWARE BASEDPACKET FILTERING AND CLASSIFICATION, invented by Wang, et al., filed onthe same day as the present application, and owned by a common assignee;and to copending U.S. Pat. No. 10/______ entitled COMPUTER SYSTEM AND isNETWORK INTERFACE WITH HARDWARE BASED RULE CHECKING FOR EMBEDDEDFIREWALL, invented by Wang, et al., filed on the same day as the presentapplication, and owned by a common assignee.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to network interface devices forinterconnecting host processors with a communication network, and moreparticularly to the processing of specific types of packets using highspeed, and/or embedded hardware at the network interface.

2. Description of Related Art

Network interface cards (NIC) are often be used for network connectionbetween a host bus system and a network medium. NICs have integratedcircuits with buffer memory for storing packets in transit. For outgoingtraffic, the packets being downloaded from host memory via the host bussystem go through a transmit packet data buffer and medium accesscontrol MAC unit to be transmitted onto the wire, optical fiber, orantenna (or otherwise transmitted on a network medium). For incomingtraffic, the packet being received from the network medium can gothrough the MAC unit and a receive packet data buffer to be uploadedinto host memory.

There are times that the packets can be processed on the NIC, ratherthan after delivery to other processing resources. For example, inembedded firewall applications, a certain field, or fields, of thepacket can be inspected to determine whether further transfer of thepacket should be allowed or denied.

Management of computer networks is accomplished in many systems by acentral network management station which has access to end stations inthe network for management functions. Several specialized controlpackets have been developed, which are transmitted to the end stationsin support of these management functions. Some of these control packetsare suitable for processing, or are designed to be processed, at thenetwork interface, rather than after delivery to the host system onwhich the network interface is attached.

In one prior art system, network interface devices are configured tocapture packets while the host system is not active, including “wake up”packets using resources on the interface card. See, NIC Device-ClassPower Management Specification, Version 1.0a, Nov. 21, 1997; MicrosoftCorporation. (See,http://www.microsoft.com/hwdev/specs/PMref/PMnetwork.htm). The NICDevice-Class Power Management Specification handles the situation inwhich a host processor running Windows or another operating system OSwants to go to sleep, yet allow others to access any shared directoriesor devices it might have offered to the network. So the host OS passesthe adapter a set of filters (where a filter in this example is a bitmask to specify which bytes in the packet are interesting, with a bytestring for comparing with the interesting bytes) which the adaptershould use. If a packet comes in that matches the filters, then theadapter wakes up, and signals power management resources in the hostsystem.

Also, inspection of a field or fields in a packet may be required insupport of logical processing of the packet for priority determinations,or other network management and system management functions.

In other examples, the packets processed on the NIC include a remotecontrol packet allowing a management console to remotely reboot thetargeted computer. Such a packet would simply be discarded by theinterface processor and an action performed to reboot the computer, suchas by sending a command to the host using a management interface likethe SMBus (See, Smart Battery System Specifications—System ManagementBus Specification, Rev. 1.0, (1995) Benchmarq Microelectronics, Inc., etal.).

In yet another example of NIC based packet processing, NIC might executeprocesses for which it needs to know the local internet protocol IPaddress of its host. This can be complicated if Dynamic HostConfiguration Protocol DHCP, or another protocol for assigning dynamicIP addresses to devices on a network, is in use by which the IP addressmight change over time. By trapping the DHCP packets and examining thembefore passing them to the host, the interface card can track thechanges in the IP address as they happen, and do it without adding anyextra instructions to the critical code paths on the host which mightincrease CPU utilization or reduce performance.

In the prior art, to process data in a packet, the processing resourceson the NIC have been required to read several fields in the packet inorder to identify fields relevant to the processing being executed. Forexample, TCP/IP packets have certain fields that have a pre-specifiedlocation in the packet based on the layer two protocol. However, the IPheader and TCP header have variable lengths. So in order to find thestart of the TCP header, the NIC must first find the start of the IPheader, and the length of the IP header to calculate the variablelocation of the start of the TCP header. Accordingly, packet processingrequires multiple read and process cycles, which make it more difficultto keep up with the packet throughput in the NIC. Therefore, there is achance that the buffer memory in the NIC will overflow, while processingresources on the NIC process a particular packet. If the memoryoverflows, packets are dropped and network performance suffers.

With 100 Megabit, Gigabit and higher wire speeds, it becomes even moredifficult for the processor to inspect the packets, especially for smallsize packets. See, International Patent Publication No. WO01/37489 A1,entitled RECEIVE FILTERING FOR COMMUNICATIONS INTERFACE, invented byConnery, et al., published on 25 May 2001, (priority based on U.S.patent application Ser. No. 09/434,253) which describes techniques forimproving performance of processor-based inspection of data packets intransit through a NIC, by reducing the number of packets that must beprocessing in the packet flow.

It is desirable to provide a network interface capable of processingpackets, without incurring the increased costs associated with higherspeed, powerful on chip, or on-board, processors. Also, it is desirableto extend the type of processes that may be executed by resources at thenetwork interface.

SUMMARY OF THE INVENTION

The present invention provides an interface that comprises the firstport on which incoming data is transmitted and received at the datatransfer rate of the network, a buffer memory coupled to the first port,and a second port coupled with the buffer memory, and through whichtransfer of packets between the host, including a host bus system, andthe buffer memory is executed. Logic is coupled to an incoming data pathfor the buffer memory to access data in the incoming packets as they arebeing stored into the buffer memory. In response to the data accessedfrom the incoming packets, the logic parses the incoming packet todetermine and store a pointer to a location in the buffer memory atwhich a data field within the corresponding packet is found. Also, theincoming packet is classified according to a protocol for the packet, bythe logic parsing the incoming packet. Embodiments of the inventionprovide for determining and storing a set of pointers for acorresponding set of locations in the buffer memory, that store keyfields in the packet.

In one aspect of the invention, the logic uses a data field from theincoming packet having a pre-specified location in the packet to computea pointer that points to a data field having a variable location in thepacket. For example, for a TCP/IP packet, a set of pointers is generatedindicating the start of the packet, the start of the IP header, thestart of the TCP header, and the start of the data payload. Because theIP header and TCP header have variable lengths, pointers having variablelocations are computed by accessing appropriate fields within theincoming packet that indicate the lengths of the headers.

In some embodiments, the buffer memory includes a transmit packet bufferto store packets in transit from the host bus system to the networkmedium, and a receive packet buffer to store packets in transit from thenetwork medium to the host bus system. The packet parsing andclassifying logic operates on packets traversing the interface in bothdirections in some embodiments.

In some environments, the logic parsing the incoming packet generates aset of pointers for corresponding packets, and stores the sets ofpointers in a packet index queue. As a set of pointers for a packetprogresses to the top of the packet index queue, the pointers are used,possibly in combination with offset values, to copy data fields from thepacket to a packet data register. Logic is coupled to the packet dataregister and uses the copied data field to generate a result relevant tothe processing of the packet in the buffer memory. The logic generates aresult before the corresponding packet is transferred out of the buffermemory. In some embodiments of the invention, the set of pointersincludes more than one pointer, and the logic operates to apply aplurality of logical functions to corresponding plurality of data fieldsaccessed using the set of pointers from the packet.

According to one aspect of the invention, logic is coupled with thebuffer memory, and stores a rule parameter. The logic accesses datafields in the packets from the buffer memory using the stored pointersand performs a logic functions based on access data fields and on therule parameter that produces a result used to allow or denying transferof the corresponding packet out of the interface. The rule parameter invarious aspects includes rule data and rule configuration values used bythe embedded logic. Therefore, an embedded firewall function isimplemented at the network interface level, which is able to keep upwith very high data rates of networks coupled to the interface. Inaddition, the embedded firewall function can be applied to packetstraversing the interface in both directions, protecting from inside andoutside attacks on the security of the host system.

In some embodiments, the logic at the network interface includes apacket data register coupled to the buffer memory to store accessed datafields, a rule data register to store a rule parameter, and functionalcircuits coupled to the packet data register in the rule data register.

In one embodiment, the functional circuits include dedicated logic toperform a set of prespecified functions which are selected by the ruleparameters. The prespecified functions in one embodiment includedetermining whether data in the packet data register is equal to data inthe rule data register, whether data in the packet data register is notequal to data in the rule data register, whether data in the packet dataregister is greater than data in the rule data register, and whetherdata in the packet data register is less than data in the rule dataregister.

In yet another embodiments, the rule parameter includes configurationvalues indicating a logic operation and an action based on results ofthe logic operation. In one embodiment, the action specified is selectedfrom allowing transfer of the packet, denying transfer the packet, andcombining the result of the operation with results of other operationson the same packet.

In yet another embodiments, the accessed data is used for computation ofpacket priority for packets being received from the network. Thus, inone embodiment, the rule parameter includes an indication of packetpriority in the event that the packet is allowed by the rule.

The network interface in one embodiment includes a cache memory storinga plurality of receive buffer descriptor lists. The cache memorymaintains subsets of receive buffer descriptor lists composed bysoftware in the host system according to a priority scheme. Packets areallocated to one of the lists based on packet priority determined by theembedded logic. Upload logic in the interface controls uploading ofpackets from the buffer memory to the host, by selecting a receivebuffer descriptor from the receive buffer descriptor cache, andtransferring the packet data to the identified buffers in host memory.

The invention also provides a method for managing an interface in whichpackets are transferred through a buffer memory between a network mediumand host bus system. The method comprises parsing packets incoming tothe buffer memory to generate and store pointers to locations in thebuffer memory of data fields in the corresponding packets. The parsing,in some embodiments, includes using fields of data in incoming packethaving pre-specified locations to compute at least one of the pointersto a field of data having a variable location in the packet. Addition,the method includes accessing data fields using the pointers prior totransferring the corresponding packets out of the buffer memory. Theaccessing in some embodiments includes using the pointers in combinationwith offset parameters. Also, embodiments include a process providing anindex memory storing a set of pointers for corresponding packets in thebuffer memory.

In other embodiments, the method includes determining and storing aclassifier for the incoming packets, which indicates whether the storedpointer is applicable to the packet. If the classifier indicates thatthe pointer or set of pointers is applicable to the correspondingpacket, then the process accesses the data field using the pointer.

One embodiment of the invention is a method for managing and interfacein which packets are transferred to a buffer memory between the networkmedium in host bus system. The method includes storing one or morepointers to data fields within packets stored in the buffer memory, andassociating one or more pointers with the corresponding packets. Ruleparameters are stored and used for applying a rule using the one or morepointers to corresponding packets. Data fields are accessed using thecorresponding pointers. The rule is applied using the accessed datafields to produce a result used to allow or deny transfer of thecorresponding packet to one of the network medium and the host bussystem to provide an embedded firewall.

The embedded firewall can be used to apply network security to hostcomputers. Packet parsing and classifying can be performed while thedownloaded packet is being written into a transmit packet data buffer ora received packet is being written into receive packet data buffer. Uponthe completion of the packet parsing, the packet start location, IPheader start location, TCP header start location and protocol type canbe stored to allow any offset within a packet to be accessed. Thefetched data can be used to compare with a predefined rule data anddetermine whether the packet should be allowed or denied along with itspriority. On transmit side, the allowed packet will be transmitted ontothe wire. On the receive side, the allowed packet will be uploaded intohost memory based on its priority.

In one embodiment used alone or in combination with the embeddedfirewall function, rules are applied for assigning a priority for uploadof a packet being received from the network.

In another embodiment, receive buffer descriptors are stored in areceive buffer descriptor cache memory on the network interface.According to the priority determined by applying rules using embeddedlogic, receive buffer descriptors for corresponding packets are assignedto one of a plurality of receive buffer descriptor lists in the cachememory. Each of the receive buffer descriptor lists has a priorityutilized by upload logic to determine the sequence for uploading packetsin the receive packet data buffer. A host driver program operates inconjunction with the network interface, and sets up correspondingreceive buffer descriptor lists in host memory.

In some embodiments of the invention, the accessed data field is appliedto embedded logic, on the same integrated circuit as the buffer memory,which operates fast enough to keep up with a data rate of the network.The speed of the embedded logic is improved because the process ofcomputing pointers for data fields in the packets is automated, andoccurs in advance of the execution of the embedded logic function. Insome embodiments, the embedded logic is dedicated logic, as opposed toprogrammable logic, that performs according to an algorithm controlledby hardwired circuitry, relieving the logic of the need to fetchinstructions during the performance of the functional logic using theaccessed data fields.

The invention also provides a computer system comprising a host CPU, ahost bus system and a network interface coupled to a high-speed datanetwork, in which packet parsing and classification are executed at thenetwork interface level, and which is configured to operate with a datarate of 100 megabits/second or higher. Particularly, the inventionenables operation of computer systems with sophisticated functionallogic at the network interface level operating with for example gigabitand 10 gigabit per second data speeds. Furthermore, the first port,second port, buffer memory, parsing and classifying logic, and embeddedfunctional logic are implemented on a single integrated circuit in somepreferred embodiments.

Other aspects and advantages of the present invention will be seen onreview of the figures, the detailed description and the claims, whichfollow.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is a simplified block diagram of a network interface includingfeatures of the present invention.

FIG. 2 is a simplified diagram of the packet parsing and classifyinglogic according to the present invention.

FIG. 3 illustrates the typical TCP/IP packet format, and key fieldsidentified according to an embodiment of the present invention.

FIG. 4 illustrates the packet parsing and classifying process accordingto one embodiment of the invention.

FIG. 5 illustrates the packet index fetch process according to oneembodiment of the invention.

FIG. 6A illustrates an extension of the packet parsing and classifyinglogic supporting multiple logic functions according to one embodiment ofthe invention.

FIG. 6B is a simplified block diagram of in embedded firewall andpriority engine according to one embodiment of the invention.

FIG. 7 is a simplified flow diagram for the rule check engine in thesystem of FIG. 6B.

FIG. 8 is a simplified diagram of a system providing for management ofclass of service according to one embodiment of the present invention.

FIG. 9 is a simplified flow diagram for the priority queue fetch enginefor the system of FIG. 8.

FIG. 10 is a simplified flow diagram for the priority packet uploadedengine for the system of FIG. 8.

FIG. 11 illustrates a structure for a receive buffer descriptor ring inhost memory according to one embodiment of the invention.

FIG. 12 illustrates a structure for a receive buffer descriptor cacheaccording to one embodiment of the present invention.

FIG. 13 illustrates a format for a receive buffer descriptor beforeallocation to a particular packet according to one embodiment of theinvention.

FIG. 14 illustrates a format for a receive buffer descriptor afterallocation to a particular packet according to one embodiment of theinvention.

DETAILED DESCRIPTION

FIG. 1 provides a basic diagram of a data processing system having ahost CPU 10 coupled to a bus system 11, such as a PCI bus. The bus 11interconnects a plurality of PCI clients, including client 12 and thenetwork interface card 13 shown with expanded functional blocks. Thenetwork interface card 13 includes an application specific integratedcircuit IC 14. The IC 14 includes network interface functions for anEthernet interface (in 100 Megabit, Gigabit, or faster formats forexample) in this embodiment. Other embodiments provide interfaces toother types of the network protocols, such as Infiniband. In addition tothe IC 14, other components are interconnected by and supported by thecircuit board of the network interface card 13. For example, a BIOS ROM(not shown), an EEPROM (not shown) and a medium connector 17 are on thecircuit board. The network interface may also be implemented on amotherboard or other mounting arrangement. Also, the integrated circuitmay be a system-on-a-chip device including the network interface logic,and other resources including an host processor.

The data processing system also includes a system management bus (notshown) coupled to the various components, including a host CPU 10, thePCI client 12, and the network interface chip 14. A system managementbus master circuit (not shown) is included which manages thetransmission messages on the system management bus. The systemmanagement system includes a system monitor, which monitors eventsrelevant to system and power management. For example, the system monitormonitors fan speed, power consumption, temperature, battery level, andthe like. Upon certain events indicated by the monitored characteristicsof the system, alert signals are issued on the system management bus.Power management logic (not shown) is included to signal the host toenter a sleep mode, or other state in which the operating system isinactive, or in a reduced activity mode.

The system management bus may comprise, for example, a bus complaintwith a standard system management bus (SMBus) specification. Each of thecomponents coupled with the system management bus, includes a systemmanagement bus slave logic block. Thus, the network interface chip 14includes SMB slave logic, which is coupled to the system management bus.

The IC 14 includes a medium access controller (MAC) 20 coupled to mediainterface circuitry 21 connecting to the connector 17. The medium accesscontroller 20 is also coupled to buffer memory on the IC 14, including atransmit FIFO buffer 22 which is driven by a download engine 23 on theIC 14. The download engine 23 is coupled to a PCI bus controller 24. ThePCI bus controller 24 is also coupled to an upload engine 25. The uploadengine 25 is coupled to a receive FIFO 26 which is connected to themedium access controller 20. Thus, the illustration of the IC 14includes basic elements of a network interface controller chip.

The network interface is used to connect to the network and providecommunication paths to pass messages to remote systems. The networkinterface operates in an OS-present state normally through the host bus11. On the transmit side, the packets can be downloaded through host bussystem 11 to the transmit packet buffer 22. The packets are forwarded tothe medium access controller (MAC) 20, which converts the packets toconform with the IEEE 802.3 Data Link layer protocol. These packets willfinally go through the physical layer interface 21 and be transmittedonto the wire (or other type of media, including wireless media) via anconnector 17. On the receive side, the packets being received from thewire will go through the physical layer interface 21 and the MAC 20before getting written into receive packet buffer 26. These packets willthen be uploaded through host bus to host memory. The host bus interface24 on the NIC 13 in this example consists of PCI slave and PCI master.The function of the PCI slave is to determine whether to accept atransaction initiated from the PCI Host. This transaction will be usedto initialize NICst registers (including rule registers describedbelow), check status, handle interrupts and control data movement. Thefunction of the PCI master is to download the packets to be transmittedand upload the packets being received through the PCI Bus. Each packetconsists of multiple fragments and each fragment can be located indifferent chunks (often referred to as buffers) of host memory. Datadownloading starts with fetching the address and the length informationof each fragment, usually from a packet descriptor composed by hostsoftware, followed by downloading the packet data from host memory tothe transmit buffer 22. This process repeats until all the fragmentswithin a packet are downloaded. In some systems, multiple transmitpacket descriptors are created, and stored in a list, to facilitatetransmission of multiple packets. In these systems, the downloadingprocess continues according to algorithms used for controlling thedescriptor lists.

Data uploading is handled the same way as data downloading except thedirection of the data is reversed, with data flowing through the receivebuffer 26 to the host bus 11. Control of uploading is also managed usingdescriptors of chunks of memory accessible using the host bus system,that are allocated for receiving packets by host software. Descriptorsfor received packets can be stored on the NIC 13, and used as needed bythe upload engine 25. In some systems, multiple receive packetdescriptors are created, and stored in a list, to facilitate receptionand uploading of multiple packets. In these systems, the uploadingprocess continues according to algorithms used for controlling thedescriptor lists, as long as packets are available for uploading fromthe receive data buffer 26.

According to the present invention, the network interface chip 14 alsoincludes a hardware-based parser/classifier 39. The parser/classifier 39is coupled to the transmit data buffer 22 and the receive data buffer26, preferably at the incoming data paths for both buffers. Also, theparser/classifier 39 is coupled to resources 40, which utilize theparser/classifier 39 to facilitate operations on packets in transitthrough the NIC 13. In one embodiment, the resources 40 comprise anembedded firewall. In another embodiment, the resources 40 compriselogic to enforce class of service queues for received packets. In otherembodiments, other functions are performed.

The parser/classifier 39 according to one embodiment of the presentinvention uses hardware to inspect packet headers while the packets arebeing written into buffer memory on the NIC 13. As it parses theincoming packets, it tries to compute a set of pointers to locations inthe buffer memory of data fields within the packet, such as the packetstart data field, the IP header start data field, the TCP header startdata field and the data payload start data field. The computed set ofpointers can be used as an index to access locations within a packet,without requiring multiple reads of data from the buffer memory. In thepreferred system, this set of pointers is stored into a Packet IndexQueue in memory on the NIC, across data paths in parallel with the inputpath to the buffer memory, essentially at the same time the packet isbeing written into the receive or transmit data buffers, and at leastbefore the packet is transferred out of the receive or transmit databuffers.

While the packet is being transferred out, a predefined start_typeparameter selects a particular pointer in the set of pointers. Theselected pointer is used with an offset value, provided by logic on theMC, to access a selected data location within a packet, which can thenbe used by processing logic to determine an action for the packet.

Since, protocols may allow header lengths to vary, as in TCP/IP, theprior art approach of using a processor to inspect the packet, requiresthe processor to read the packet header multiple times, and perform allthe necessary computation to identify the protocol type, headerlocations, and payload starting locations for the packet. The methoddescribed in this invention can have all the information availablebefore processing begins, preferably through hardware, by performingparsing and classification as the packet is being written into thereceive or transmit data buffers.

Features of the hardware based packet parser and classifier include, butare not limited to the following:

-   -   Allows packets to be parsed while being written into Packet        Buffer on both transmit and receive directions.    -   Allows locations of key fields, such as packet start location,        IP header start location, TCP header start location and data        start location, to be identified and stored into a Packet Index        Queue before the complete packet is being written into Packet        Buffer.    -   Allows start locations to be identified at once prior to        completing the packet write into Packet Buffer, even while the        IP header and TCP header have various lengths.    -   A Packet Index Queue can store various start locations for        multiple packets while they are being written into Packet        Buffer. While the current packet is being read out for rule        check, the subsequent packets can be parsed and stored into        Packet Index Queue for further use.    -   Packet Protocol can be identified and stored which can be used        to determine whether hardware will perform the required rule        check function or processor will be used to handle non-timing        critical tasks for management or control packets.    -   While the packet information is being read out of Packet Index        Queue, it can be used to determine which start location (packet,        IP header, TCP header or data) of the stored packet can be used        for rule check or priority assignement.    -   The start location of the packet can be indexed by offset to        select any packet entry in Packet Buffer to be used for rule        check or priority assignment.    -   Only one memory (Packet Buffer) access is needed per rule to        optimize performance for high-speed wire rate support.    -   Since only one memory access is needed, multiple rules can be        applied to a single packet and still be able to achieve Giga-bit        wire speed.

In one aspect of the invention, the resources using theparser/classifier comprise an embedded firewall. Thus, the presentinvention also provides an innovative scheme to perform rule checkfunctions for embedded firewall applications through hardware. With ahardware-based approach, multiple rules can be applied to an incoming oroutgoing packet at Gigabit speeds. System performance can be maximizedwith lower cost to produce embedded firewall product.

Features of a hardware based rule check for embedded firewallapplications, according to the present invention, include but are notlimited to the following:

-   -   Any offset within a packet can be used for rule check.    -   Any range can be specified through Rule Mask Register by masking        the lower bits for rule check.    -   “Equal”, “Not Equal”, “Greater than” or “Less than” operation        modes can be specified for rule check.    -   “Allow”, “Deny”, or “AND with the next rule” can be specified as        the required action upon rule match.    -   Match on any one of a set of rules can be used to take the        required action (Allow or Deny).    -   Multiple rules match through “AND with the next rule” option can        be used to take the required action (Allow or Deny).    -   For each rule, only one packet buffer access is required to        fetch the data from the offset specified through the particular        local rule register set.    -   Rule check can be performed on download/transmit path, which can        filter and control the outgoing traffic to protect inside        attack.    -   Rule check can also be performed on receive/upload path, which        can filter and control the incoming traffic to protect outside        attack.    -   Upon rule match, if “Allow” is specified, the outgoing traffic        can be transmitted onto the wire and the incoming traffic can be        uploaded into host memory.    -   Upon rule match, if “Deny” is specified, the packet can be        discarded from the packet buffer to disallow the outgoing        traffic to be transmitted onto the wire and to disallow incoming        traffic to be uploaded into host memory.    -   Upon rule match, if “AND with next rule” is specified, the        subsequent rules can be evaluated prior to taking any action.

If all the ANDed rules are matched with “Allow” specified as the neededaction, the priority level specified in the last rule can be used as theorder to upload the received packet to host memory.

-   -   No need for processor to read the packet header each time a rule        is being evaluated.    -   Giga-bit wire speed for embedded firewall applications can be        achieved even with large amount of rules to be evaluated.

In one aspect of the invention, the resources using theparser/classifier logic providing an innovative scheme to performmanagement of packet priority. According to this aspect of theinvention, priority traffic can be implemented on the NIC to provideclass of service support. Multiple buffer descriptor rings can be usedto support this feature. On transmit side, management of class ofservice is more straightforward since NIC driver software in the hostsystem, knows the priority of each packet. Multiple Transmit BufferDescriptor (TBD) rings can be constructed in host memory using the NICdriver with different priority levels assigned to each of them. Thus, insome embodiments, the TBDs are set up in TBD rings by the NIC driver inadvance based on packet priority level. The TBDs can then be transferredto a corresponding TBD cache on the NIC. NIC hardware will fetch theTBDs from its TBD cache based on the priority level, and use thetransmit buffer address and length information stored in the entry ofthe TBD cache to perform the data download DMA operation from hostmemory to the transmit packet data buffer.

On receive side, class of service management is more complicated sincethe NIC driver in the host is not aware the priority of the receivedpackets. Thus the host software cannot assign a priority for upload ofreceived packets. The present invention provides a method to use thepacket parser/classifier to determine whether the current packet beingreceived should be allowed or denied. If the packet is to be denied, itwill be discarded from receive packet data buffer. Otherwise, a receivebuffer descriptor in a RBD cache is allocated to the allowed packet.Multiple RBD lists are established in the cache, and the allocation ofan allowed packet to one of the RDB lists is based on a priorityassignment generated by the logic on the NIC. The Upload Engine willfollow the priority of the RBD lists to retrieve the highest priorityRDB, and use the information in the RBD to upload the received packetinto host memory.

Features of embodiments of a hardware based rule check for management ofclass of service for received packets, according to the presentinvention, include but are not limited to the following:

-   -   Packet parsing logic can be used to parse the packet start, IP        header start, TCP header start and data start locations along        with the protocol type. This information will be stored into        Packet Index Queue.    -   Rule check logic can be used to evaluate the pre-defined rules        and compare with the data field at any offset of the packet. A        match found will cause the packet to be denied or allowed.    -   Priority level will be used to specify the packet priority for        it to be uploaded into host memory if the packet is to be        allowed after rule match.    -   Packet priority can be determined through rule match with IP        header Type of Service (TOS) field, or it can be determined        through rule match on any data value within any packet offset.        The priority register can be used to specify the packet priority        upon rule match.    -   Upon completing rule match, Allow, Deny and Priority from rule        check as well as packet address and packet length from Packet        Index Queue for the received packet will be stored into a        Priority Queue.    -   Priority Queue Fetch Engine will fetch each stored entry from        Priority Queue. If the packet is to be denied, it will be        discarded from receive packet data buffer. Otherwise, the packet        address and length will be placed into the corresponding RBD        cache entry selected through its priority level.    -   Multiple RBD rings (1˜n) can be constructed in host memory. Each        RBD ring consists of multiple Receive Buffer Descriptors (RBD).        Each RBD will be used to specify the address and length of the        receive buffer in host memory for the received packet to be        uploaded.    -   Each RBD ring is assigned a priority level (e.g., 1—highest,        n—lowest) which can be used for the received packet to be        uploaded into host memory based on its priority.    -   Each RBD ring has its associated RBD cache in NIC memory. These        caches can be used to prefetch the RBDs from RBD rings from host        memory, which can then be used by Upload DMA Engine to upload        the received packets from NIC's receive packet data buffer into        host memory.    -   Each entry in RBD cache needs to be updated with the received        packet's address and length while the received packet        information is fetched from Priority Queue. Based on the        priority of the packet, the entry pointed by cache_cur_ptr        within the corresponding RBD cache will be updated accordingly.    -   Upload Engine will follow the priority of the RBD cache to        upload the packet from NIC's receive packet data buffer into        host memory. Packet address and packet length stored in each        entry of the RBD cache can be used by Upload DMA Engine to        access the received packet from receive packet data buffer; Host        receive buffer address stored in the entry of the RBD cache can        be used by Upload DMA Engine to locate the receive buffer in        host memory to upload the received packet.

A more detailed description of the packet parser/classifier 39 isprovided with reference to FIG. 2. FIG. 2 shows a simplified blockdiagram of the packet parser/classifier 39 with buffer memory 100, thatcorresponds to one or both of the receive and transmit packet buffers26, 22 of FIG. 1. Packets are written to the buffer memory 100, largeenough to store more than one packet of typical size for the particularnetwork, from an incoming data path 101. The write pointer WrPtr 102specifies an address for each byte as it is written to the buffer memory100. In parallel with the buffer memory 100, the incoming data path 101is coupled to packet parser logic 103, and to a plurality of incomingregisters 104-108. In this example, the plurality of incoming registers104-108 is used to store pointers used to locate key fields in a TCP/IPprotocol packet (packet start, IP header start, TCP header start, datapayload start), and to store a value (protocol) indicating whether theincoming packet is compliant with the TCP/IP protocol.

The incoming registers 104-108 and the packet parser logic 103 arecoupled to memory 109 can be used as a packet index queue. The memory109 is coupled to a plurality of outgoing registers 114-118, whichcorrespond to the incoming registers 104-108. Also, a packet index fetchengine 119 is coupled to the memory 109 and to the register 118. Theregister 118 holds a code indicating the protocol of the current packet,that is used by the packet fetch engine 119. The other registers in theplurality of outgoing registers 114-117 are coupled to a multiplexer125. A parameter start_type 126 is applied by data processing resources130 to control the multiplexer 125 to select one of the outgoingregisters to supply an output on line 127. An offset value 128 isapplied by data processing resources 130 which is added in logic 129 tothe value on line 127. The output of the logic 129 is an address on line131 used for a read of a location in the buffer memory 100. The datafield at the location addressed is provided to a packet data register132, which is coupled to the data processing resources 130. The dataprocessing resources 130 produce results that can be used prior totransferring a packet out of the buffer memory 100, or prior totransferring the packet out of the interface, as discussed above.

This example illustrates a structure that is used to parse packets andstore key pointers for a single protocol (TCP/IP), and to indicatewhether the current packet is compliant with that protocol. Otherembodiments extend the capabilities to a plurality of network protocols.

FIG. 3 shows the basic structure of a TCP/IP packet format with keyfields identified. The offset 0 corresponds with the packet start datafield. The first data field after the end of the MAC header (afteroffset 13) corresponds with the IP header start location, and stores aparameter in the lower four bits, indicating the IP header length. TheTCP header start location is equal to the IP header start location plusthe IP header length. The TCP header length is found at offset 12 afterthe beginning of the TCP header. The data payload start location isfound at the TCP header start location plus the TCP header length value.The IP header length and TCP header length values are variable, andtherefore cannot be determined without inspecting each packet. Usingpointers to the packet start location, the IP header start location, theTCP header start location, and the data payload start location,essentially any data field in the packet can be located without furtheranalysis of parameters within the packet headers.

Thus, the packet parser/classifier is used to parse the packet while itis being written into Packet Data Buffer (PDB). The parsed packet can beeither a downloaded packet to be transmitted onto the wire or a receivedpacket to be uploaded into host memory. After packet write startcondition is detected, packet parser logic as shown in FIG. 4, will beactivated to write the current packet write pointer (WrPtr) intoPacket_start_in register 104, which indicates start of packet (Sop)condition (block 140). The packet data is written into the packet databuffer (block 141). After each data byte is written into a PDB, packetwrite complete status will be checked (block 142). If the packet has notbeen completely written into PDB at block 142, the packet write willcontinue with WrPtr incremented each time a packet data is being writteninto the PDB. The process checks for the beginning of the IP header atblock 143. As soon as 14 bytes of MAC header has been written into PDB,the process branches to block 144, where the WrPtr will be equal toSop+14, which is the starting location of the IP header. The lower 4bits of data in this location will be loaded into an IpHeaderLenregister, and the current WrPtr will be loaded into IpHeader_start_inregister 105, which can be used as the base address of the IP header andallow any offset indexed with this header to be accessed properly.Finally, TCP header start address can be computed through“WrPtr+IpHeaderLen”, which can be loaded into TcpHeader_start_inregister (block 144).

After IP and TCP header starting locations have been identified, packetwrite to PDB will continue on until it reaches IP header offset 10 d(block 145). The data in this header offset field will be loaded into,or used to set a code in, Protocol_in register 108 which can be used toidentify the protocol type of the packet (block 146).

Packet write will proceed until all the IP header data has been writteninto PDB. Writing of the TCP header to the PDB will follow until offset12 d is reached (block 147). The TCP header length stored in this fieldwill be used to compute the starting location for packet data through“Sop+14+IpHeaderLen+TcpHeaderLen”, which will be loaded intoData_start_in register 107 (block 148).

The process loops from blocks 144, 146 and 148 to block 149 where theWrPtr will be incremented by one, and thereby pointed to the next packetdata location until all the packet data are written into PDB (block142). Protocol_in, Packet_start_in, IpHeader_start_in,TcpHeader_start_in and Data_start_in registers will be stored into thePacket Index Queue, which can then be used with the pre-specified starttype and offset to retrieve the packet data from the PDB for variousapplication needs (block 150). At this point, the process is ready toreceive a following packet.

The Packet Data Buffer (PDB) can be used to store the downloaded packetfor transmitting onto the wire or received packet for uploading intohost memory. While the packet data is being written into PDB, the packetparser/classifier will be invoked to perform packet parsing in paralleland store the related information into a Packet Index Queue in memory109. This information will allow the packet start, IP header start, TCPheader start and data start locations to be identified in Packet DataBuffer for each stored packet, which can then be used to access anyoffset within a packet for rule check or priority assignment.

The Packet Index Queue in memory 109 is used to store packet protocoltype, packet start location, IP header start location, TCP header startlocation and data start location for associated packets in the PDB. Thisinformation can be obtained through parsing the packet header while itis being written into PDB, which can then be used by the Packet IndexFetch Engine 119 to determine where the packet starts along with theoffset to retrieve the packet data.

The Packet Index Fetch Engine 119 can be used to fetch the stored packetinformation from Packet Index Queue in the memory 109. A flow diagramfor the packet fetch engine is shown in FIG. 5. The process begins in anidle state (block 160). Whenever the Packet Index Queue is not empty,packet index fetch will be initiated (block 161). The top entry will beread out from Packet Index Queue to verify protocol type (block 162). Ifthe packet is not a TCP packet, control will go back to IDLE (block 160)since there is no further need to perform packet inspection for thissingle protocol embodiment. Otherwise, packet start, IP header start,TCP header start and data start locations will be loaded toPacket_start_out, IpHeader_start_out, TcpHeader_start out andData_start_out registers 114-117. The start-type value in register 126will be used to select the right start location, which will then beadded with the offset field from register 128 to generate the addressfor accessing a location of a data field in the PDB. After the access tothe packet data buffer is granted, the packet data from the specificlocation within PDB will be loaded into Packet Data Register 132 forprocessing using the data processing resources 130.

FIG. 6A illustrates an extension of the packet parser/classifier of FIG.2 for the purposes of specifying a plurality of offset values 128 and aplurality of start_type values 126. Components labeled with the samereference numerals as used in FIG. 2 are not re-described. To extend theparser/classifier to handle multiple offset and start_types, amultiplexer 200 is added which is coupled to a plurality of rulespecific registers storing a start_type value (start_type_1,start_type_2, . . . start_type_n) for each of a plurality of logicfunctions. Also, a multiplexer 201 is provided which is coupled to aplurality of rule specific registers storing an offset value (offset_1,offset_2, . . . offset_n). A rule select parameter rule_sel [i] 202 isapplied to the multiplexers 200, 201 to select an appropriate rulespecific value for a current logic functions being executed by the dataprocessing resources. The extension of the packet parser/classifiershown in FIG. 6A is adapted for use with an embedded firewall and classof service manager, which applies a plurality of rules. A basic diagramof the data processing resources that support the embedded firewall areshown in FIG. 6B.

According to an example embodiment which is described with reference toFIG. 6B, the embedded firewall includes a global rule valid register205, and a plurality of rule specific registers.

In this example, there is only one global rule register among all thesupported rules. One example format for the rule valid register 205.Each bit of the rule valid register 205 can be used to enable rule checkfunctions for a specific rule. The number of bits set in the rule validregister 205 indicates the number of enabled rules. The rules areenabled for example, in ascending order (from lower bits to higher bitsof the rule valid register). Each rule is serviced in the orderindicated in the rule valid register, until a zero is detected,indicating that all the rules have been evaluated for the currentpacket.

Each rule consists of a set of rule specific registers in this examplewhich can be used to perform rule check functions. Rule Data Register206 specifies the data to be used for rule check. This data can be usedto compare against data at any offset within a packet. All the possibleoffset can be indexed from the beginning of the packet, the beginning ofthe IP header, the beginning of the TCP header and the beginning of thepayload. For example, if we want to allow the access of a particular TCPsource port, we can specify the port number in rule data register to beused for comparison.

Rule Mask Register 207 can be used to mask off any number of the lowerbits between Rule Data Register and Packet Data Register. While RuleData Register is used to specify the data to be used for rule check,Packet Data Register can be loaded from any offset within a packet. Thestart location is selected through start_type, it will be indexedthrough the offset field defined in Rule Config Register to access anyoffset within a packet. If certain destination IP address ranges areused to determine whether the packet should be allowed or denied, thelower bits in Rule Mask Register can be set to “0” which will mask offthe lower bits in Rule Data Register and Packet Data Register to be usedfor comparison.

Rule Config Register (not shown) can be used to set up the operationmode for rule check, determine the required action upon rule match,select the type of the offset start location and specify the offsetvalue which can be used as an index to access any data location within apacket. In one example, the Rule Config Register comprises bits [17:0],defined as follows:

-   -   bit[1:0]: operation_sel_n 208 are used for selecting the desired        operation to be performed for rule check. 00—equal; 01—not        equal; 10—greater than; 11—less than.    -   bit[3:2]: action_sel_n 209 can be used to select the action to        be taken upon rule match. 00—allow; 01—deny; 10—AND next rule;        11—NA.    -   bit[5:4]: start_type_n (see FIG. 6A) can be used to specify the        starting location of the offset to be used for rule check.        00—beginning of the packet; 01—beginning of the IP header;        10—beginning of the TCP header; 11—beginning of the data        payload.    -   bit[17:6]: offset_n (see FIG. 6A) are used to specify the offset        to be indexed from the starting location defined in bit[5:4].        The data being fetched will be loaded into Packet Data Register        which can be used to compare with the data specified in Rule        Data Register for rule check.

A rule priority register 210 can be used to specify the priority levelof each rule rule_priority_1, . . . , rule_priority_n). IN oneembodiment, if a rule match is found for a received packet and thepacket is to be allowed, it will be uploaded into host memory based onthe priority setting. For multiple rules with “AND” condition specified,the priority level set in the last rule can be used as the order for itto be uploaded into host memory.

FIG. 6B illustrates the basic configuration of dedicated logic used forexecuting an embedded firewall using the global and rule specific(local) rule registers described above. A rule check engine 210 managesthe rule checking. The rule check engine 210 produces a packet indexqueue read command PIQ_read and a rule select command rule_sel [i] online 211 which is supplied to the packet parser/classifier of FIG. 6A.The inputs to the rule check engine 210 include the rule valid register205 and the allow or deny signals on lines 212 and 213 respectively,produced by the application of the rules as described below. Inaddition, the rule check engine 210 issues the signal pkt_data_load online 216 to control loading of a selected data field from the packetbuffer 100 into the packet data register 132. The results of operationof the rule check engine 210 include a command on line 214 to allowtransfer of the packet out of the data buffer 100, or a command on line215 to discard the packet.

In this example, dedicated hardware is provided for each of thesupported rules which includes generally a rule match block and anaction select block. The dedicated hardware is controlled by the globaland local rule registers without additional instructions.

The rule match block is shown for a single rule in FIG. 6B. The rulematch block includes the rule data register 206, the rule mask register207, gates 220 and 221 which are coupled to the rule data register 206and packet data register 132, respectively, and apply the rule mask fromthe rule mask register 207. The masked outputs from the gates 220 and221 are applied to operational logic blocks to 222-225, which performrespective logic functions. In this example, the logic functions includeequal to (block 222), not equal to (block 223), greater than (block 224)or less than (block 225). The output set of the logic blocks 222-225 areapplied to a multiplexer 226, which is controlled by the operation_sel_1parameter from the local rule register on line 208. The output of themultiplexer 226 is a signal on line 227, indicating whether the packetdata matches the rule (rule_match_1). A plurality of rule match blocksare cascaded on the chip for rules 2 to n, and generate respectiveoutputs, rule_match_2 to rulematch_n, as each valid rule is applied insequence under control of the rule check engine 210.

Action select blocks are illustrated for rule 1 and rule 2 in FIG. 6B.Additional action select blocks are provided for each of the rulessupported by the rule check engine 210. The action select block for thefirst rule includes selector 228, which is responsive to the rulespecific register value action_sel_1 on line 209 to generate a controlsignal allow_1, a control signal deny_1, or a control signal and Next_1.

The action select block for rule 2 includes gate 230 that receives thecontrol signal and Next_1 from the previous action select block, andreceives the output rule_match_2 from the rule match block (not shown)for rule 2. The output of the gate 230 and the rule_match_2 signal areapplied to a multiplexer 231. The multiplexer 231 is controlled by theand Next_1 signal to select either the output of the rule match logicfor rule 2, or the logic AND of the and Next_1 signal with therule_match_2 signal as output to the selector 232. The selector 232 iscontrolled by the action_sel_2 signal from the local register for rule 2to select allow (allow_2), deny (deny_2), or and Next2 as results of arule match at this level of the rule check engine. The and Next_2 signalis supplied and cascaded to the next action select block in the rulecheck logic. The allow and deny signals are applied to respective ORgates 233, 234. The outputs of the OR gates 233, 234 are applied onlines 212 and 213, respectively, to the rule check engine 210.

The respective allow signals (allow_1, . . . allow_n) are also suppliedto a priority selector 240. The inputs to the priority selector 240include the local priority registers (rule priority 1, . . . rulepriority n). The output of the selector 240 is a priority signalutilized for management of class of service processes described in moredetail below.

Thus, as described above, each packet may have multiple rules to beapplied by the rule check engine, which operates for example as shown inFIG. 7. The process begins in an idle state, in which the index value“i” is set equal to 1 (block 250). Upon detecting that the Packet Indexqueue is not empty, rule check will be initiated, and the processproceeds to block 251. In block 251, the first entry in the Packet IndexQueue will be loaded into Packet_start_out, IpHeader_start_out,TcpHeader_start_out and Data_start_out registers (114-117). The lowestbit in Rule Valid Register will be checked (block 252). If the valid bitis set to 1, a valid rule exists. If a valid rule exists for index “i”,the rule check logic will be invoked. The control parameter rule_sel[i](while i=1 for the first rule) will be asserted to select thecorresponding rule's start_type (packet start, IP header start, TCPheader start or data start) and offset field (a byte count from thestart location). The starting location of the packet indexed with theoffset will be used as the address to access packet data in Packet DataBuffer. The signal pkt_buf_req will be asserted to request the PacketData Buffer access (block 253). After pkt_buf_gnt is returned (block254), the data being accessed within a packet will be read from thepacket buffer, and loaded into the packet data register (block 255).This data will be compared with the data specified in the Rule DataRegister, with a mask applied through Rule Mask Register. The ruleparameter operation_sel_i will be used to select the operation mode (=,!=, >, <) to be used for comparison. A rule_match_i signal will beasserted upon rule match.

The rule parameter action_sel_i (specified in Rule Config Register) canbe used to select the needed action upon rule match. Packet can beallowed, denied or combined logically (e.g. AND) with the subsequentrules to determine the required action.

If the packet is to be allowed (block 256), it will be submitted toupload or transmit (block 257). If the packet is to be denied (block258), the denied packet will be discarded from Packet Data Buffer (block259). If the packet is neither allowed nor denied, in the index “i” isincremented by 1 (block 260). The process then returns to block 252 totest the next rule.

If the action select value action_sel_n indicates the action “AND withnext rule,” then the allow and deny signals are not asserted, and onlywhen all the ANDed rules have been applied will the engine take actionwith the corresponding packet. In this example, the combination of rulesthat may be applied for a given allow/deny decision is limited by the“AND with next rule” action. Other embodiments allow for other rulecombinations to be applied, by providing for the use of rule output maskregisters, or other logical operators for the purposes of rulecombinations. For example, when multiple protocols are supported, a ruleoutput mask may be utilized to select an appropriate set of valid rules.

After all the rules for the current packet are evaluated, control willmove to the next packet. The above steps will be repeated until all thepackets in Packet Index Queue have been processed for rule check.

Reference is made to FIGS. 8-14 for a description of one embodiment oflogic to manage class of service using the priority output 240 fromselector 239 of FIG. 6B, or other priority determination logic.

FIG. 8 illustrates a basic block diagram of any data processing systemincluding a NIC 13, host bus system 11, and host CPU 10 as illustratedin FIG. 1 for the purposes of describing the management of class ofservice. In a host bus system running a PCI bus protocol, a typicalconfiguration includes a so-called “southbridge” 300 coupled to the bus11. A “northbridge” 301 is coupled to the southbridge, and to high-speedhost memory 302. The host CPU 10 is coupled to the northbridge 301.Other configurations of host bus systems may be utilized as well,providing access by the host processor 10 to the host memory 302. Thehost memory 302 is used for a variety purposes, including storing packetdata uploaded or ready to be downloaded to the NIC 13, receive bufferdescriptor RBD lists, and memory for other applications. Such data mayalso be stored in other host memory accessible using the host bus system11. In this example, the receive buffer descriptor RBD lists areimplemented in a ring format, and include RBD ring [1], RBD ring [2], .. . RBD ring [n]. According to this embodiment each ring [1, . . . , n]is utilized for a different class of service having respectivepriorities. The host driver software sets up the RBD rings in hostmemory to support the class of service management. Packets that qualifyfor a given ring, and the corresponding class of service, are identifiedin the interface.

In FIG. 8, functional components of the NIC 13 supporting management ofclass of service are illustrated. Thus, a receive packet data buffer 305is coupled by an incoming data path 310 to the MAC and physicalinterface 306, which is in turn coupled to the network medium 307. Thebuffer 305 is coupled via line 308 to the host bus system 11. Theincoming data path 310 is coupled to a packet parser/classifier 311,like that described above with respect to FIG. 2. A packet index queue312 is produced as described above. The packet index queue 305 is usedby the rule check engine 313, as described above with respect to FIGS.6A, 6B and 7. The packet index queue 312 and rule check engine 313supply parameters to the priority queue block 314. The priority queueblock 314 supplies allow/deny signals 315, priority signals 316, andpacket address and packet length values 317, referencing the receivepacket data buffer 305, as outputs. The allow/deny signal from register315 is applied to a priority queue fetch engine 318. Likewise, thepriority value from register 316 is applied to the priority queue fetchengine 318. The packet address and packet length values from register317 are applied to the selector 319, which directs the values to anappropriate ring segment in a receive buffer descriptor cache 320. Thereceive buffer descriptor cache 320 stores at least a portion of each ofthe active receive buffer descriptor rings in the host memory 302, whichare active during the uploading of the packet. While packets areavailable for upload, the priority packet upload engine 321 accesses anentry from the highest priority ring in the receive buffer descriptorcache 320 and receives the receive buffer address RB_addr 322 and thereceive buffer length RB_len 323 for the host buffer in host memory, aswell as the packet address Pkt_addr 324 for the corresponding packet inthe receive packet data buffer 305. These parameters are utilized tocontrol uploading of the corresponding packet into the host memory orother locations accessible via the host bus system.

Operation of the priority queue fetch engine 318 is described withreference to FIG. 9. But the process begins in an idle state (block330). When the Priority Queue is not empty, the priority queue fetchengine 318 will be activated to fetch the top entry from the PriorityQueue. This information will be loaded into Allow, Deny, Priority,Packet_addr and Packet_len registers (block 331). If the packet is to bedenied (block 332), the packet will be discarded from receive packetdata buffer to free up the space (block 333). Otherwise, if the packetis to be allowed (block 334), the corresponding RBD cache ring will beselected through the packet priority level. Packet_addr and Packet_lenwill be stored into a corresponding cache entry pointed by the output ofselector 319, which can then be used by priority packet upload engine321 to upload the packet through PCI Bus to host memory (block 334). Ifthe packet is neither to be allowed nor to be denied, it may needfurther inspection. The host processor, or other processing resources,can be invoked to determine the needed action (block 335).

After the packet information has been stored into its RBD cache entry,then a cache pointer cache_cur_ptr will be incremented by one point tothe next RBD cache entry. The next Priority Queue entry will then beavailable for access by the priority queue fetch engine 318 (block 337).

Operation of the priority packet upload engine 321 is described withreference to FIG. 10. While in idle state, index “i” will be set to 1,which will allow the highest priority RBD cache (RBD cache ring [1]) tobe used for handling the priority packet upload operation (block 340).Next, the appropriate RBD cache ring is checked (block 341). If thiscache is empty (block 342), the process determines whether the last ringhas been checked (block 343). If the last ring has been checked, loopreturns to block 340. If the last ring has not been checked, “i” will beincremented by one, to point to the next priority RBD cache ring (block344). If at block 342, the appropriate RBD ring is not empty, then thetop entry of this RBD cache ring will be fetched. The information storedin this entry will be loaded into RB_addr, RB_len and Pkt_addr registers(block 345). The RB_addr is used to identify the host memory locationfor the packet to be uploaded. RB_len is used to indicate the hostmemory receive buffer size. Pkt_addr is used to locate the packetaddress in NIC's receive packet data buffer. The packet data stored inreceive packet data buffer pointed by Pkt_addr register will be uploadedinto the host memory receive buffer pointed by RB_addr (block 346).Next, the algorithm determines whether the RB_len parameter has beendecremented to all 0 (block 347). Each time a packet data is uploaded,Pkt_addr and RB_addr will be incremented by one to retrieve the nextpacket data from NIC's receive packet data buffer and upload it into thenext host memory location. Also, the RB_len will be decremented by oneto indicate the packet length remaining to be uploaded (block 348). Thisprocess will repeat itself until all the packet data has been uploadedinto host memory, indicated when the RB_len count reaches zero. Thealgorithm then returns to block 341 to access the next cache entry.

If there are any additional entries available in the same RBD cache,above process will be repeated until all the entries are being handled.Otherwise, “i” will be incremented by one to access the next priorityRBD cache (RBD cache ring [2]) (block 344). Each entry in this RBD cachewill be fetched and used the same way to upload the received packet fromreceive packet data buffer into host memory until all the entries inthis RBD cache are being serviced. Each RBD cache will be accessed inabove sequence by incrementing “i” until it reaches “n+1”, whichindicates that all the RBD caches have been used (block 343). Controlwill go back to idle waiting for the next available RBD cache.

The receive buffer descriptor structure is described with reference toFIGS. 11 through 14 for one preferred example of the present invention.FIG. 11 represents the receive buffer descriptor ring in host memory.The ring includes a plurality of entries, entry 1, entry 2, entry 3, . .. entry n. The ring memory space is defined by a starting addressring_start_addr, and ending address ring_end_addr. The plurality ofentries are located within the memory space by a ring_head_ptr pointingto the first entry in the list, and a ring_tail_ptr which points to adata location following the last entry in the list. The RBD rings areused to store the RBDs which can be used to upload the received packetsfrom receive packet data buffer into host memory. There are “1˜n” RBDrings constructed in host memory with “1” to be assigned as the highestpriority and “n” to be the lowest priority. These RBDs are set up by adriver, usually under control of the host system, and are prefetchedinto NIC's local RBD cache using a cache management routine. Each ringshares the same data structure with ring_start_addr and ring_end_addr todefine the address space for each ring in host memory. The ring_head_ptrpoints to the top entry within each ring that is available for prefetchinto local RBD cache, for use by an upload operation. The ring_tail_ptrpoints to the first available entry for a next RBD entry to be appendedto the list by the driver.

FIG. 12 illustrates the RBD cache data structure. The RBD cache stores asubset of the RBD entries from the host rings, in memory on the NIC toallow fast descriptor access by Upload Engine to transfer the receivedpackets into host memory. The RBDs in host memory can be prefetched intoNICs RBD cache in burst mode. Each RBD cache has a set of pointers,including a read pointer cache_read_ptr, a write pointer cache_wr_ptr,and pointer to a current entry cache_cur_ptr. The cache_read_ptr can beused by the Upload Engine to fetch the top entry from RBD cache. Thecache_wr_ptr can be used to transfer the RBDs from host memory into RBDcache. The cache_cur_ptr can be used by Priority Queue Fetch Engine tostore the received packet address and length in the buffer memory, whichcan then be used by the Upload Engine to upload the received packet fromreceive packet data buffer into host memory.

FIGS. 13 and 14 illustrate the structure of the descriptors for oneembodiment of the invention. FIG. 13 illustrates the structure before apacket is allocated to the descriptor. Each Receive Buffer Descriptor(RBD) prefetched from host memory to RBD cache on the NIC has the formatof FIG. 13, which consists of Host Rx Buffer Address and Host Rx BufferLength. Host Rx Buffer address and length are provided and set up inhost memory through the driver, and locate the receive buffer in hostmemory for the packet to be uploaded. The Host Rx Buffer Length fieldoccupies the bits 13:0 of a first word in the descriptor. The Host RxBuffer Address occupies bits 31:0 of a second word. Bits 31:14 of thefirst word are reserved.

After the information for the received packet is fetched from thepriority queue, the descriptor format is changed to that shown in FIG.14. In the format of FIG. 14, the NIC received packet address will bestored in bits 31:14 of the first word, and the NIC received packetlength will replace Host Rx Buffer Length in bits 13:0 of the firstword. While Host Rx Buffer address can be used to locate the Rx Bufferin host memory for the packet to be uploaded, the NIC received packetaddress and length can be used to access the received packet in receivepacket data buffer to be uploaded through PCI bus to host memory.

In summary, a data processing system adapted for high-speed networkcommunications, a method for managing a network interface and a networkinterface for such system, are provided, in which processing of packetsreceived over the network is achieved by embedded logic at the networkinterface level. Incoming packets on the network interface are parsedand classified as they are stored in a buffer memory. Functional logiccoupled to the buffer memory on the network interface are enabled toaccess any data field within a packet in a single cycle, using pointersand packet classification information produced by the parsing andclassifying step. Results of operations on the data fields in thepackets are available before the packets are transferred out of thebuffer memory. A data processing system, a method for management of anetwork interface and a network interface are also provided by thepresent invention that include an embedded firewall at the networkinterface level of the system, which protects against inside and outsideattacks on the security of data processing system. Furthermore, a dataprocessing system, a method for management of a network interface and anetwork interface are a provided by the present invention that supportclass of service management for packets incoming from the network, byapplying priority rules at the network interface level of the system.

While the present invention is disclosed by reference to the preferredembodiments and examples detailed above, it is to be understood thatthese examples are intended in an illustrative rather than in a limitingsense. It is contemplated that modifications and combinations willreadily occur to those skilled in the art, which modifications andcombinations will be within the spirit of the invention and the scope ofthe following claims.

1.-74. (canceled)
 75. A method of managing packet transmission, themethod comprising: determining a classifier for an incoming packetcomprising a data payload destined for an application; generating apointer to a data field in the incoming packet; storing the incomingpacket in a buffer memory; using the pointer to retrieve data associatedwith the data fields from the buffer memory; determining a priority fortransferring the data payload associated with the retrieved data fromthe buffer memory to a host system memory; and using, by a processor,the pointer to transfer the data payload associated with the retrieveddata from the buffer memory to an application running in the host systemmemory according to the determined priority.
 76. The method of claim 75,wherein determining the priority for transferring the data payloadfurther comprises determining the priority by applying a rule of aplurality of rules to the retrieved data.
 77. The method of claim 76,wherein the classifier indicates which rule of the plurality of rules isapplied to the retrieved data associated with the data fields of theincoming packet.
 78. The method of claim 76, wherein applying the rulefurther comprises, for each rule: storing a rule data value; storing theretrieved data; and performing a function defined by a rule parameter.79. The method of claim 75, wherein generating a pointer to a data fieldin the incoming packet comprises generating a pointer to one of a startof the incoming packet, a transmission control protocol header of thepacket, and a data payload portion of the packet.
 80. The method ofclaim 75, wherein using the pointer further comprises using the pointerin combination with an offset parameter to retrieve data, wherein thedata is associated with the fields of the incoming packet from thebuffer memory.
 81. The method of claim 75, wherein determining apriority for transferring the data payload further comprises applying arule to the retrieved data to determine the priority for transferringthe data payload.
 82. The method of claim 75, further comprising:parsing the incoming packet to determine the classifier and to store theclassifier.
 83. The method of claim 75, further comprising: receivingthe incoming packet at an interface between a network medium and a hostsystem.
 84. A method for transferring packets between a network mediumand a host bus system, said method comprising: accessing data fields ina plurality of packets stored in a buffer memory, wherein the buffermemory is to store packets in transit between the network medium and thehost bus system; and determining, by a processor, a priority fortransfer of the plurality of packets out of the buffer memory based onthe accessed data fields and a rule parameter.
 85. The method accordingto claim 84, wherein determining the priority for transfer of theplurality of packets further comprises performing a logic function basedon the accessed data fields and the rule parameter that produces aresult; and using the result to determine the priority for transfer ofthe plurality of packets out of the buffer memory.
 86. The methodaccording to claim 84, further comprising: storing a plurality of listsof buffer descriptors for the plurality of packets stored in the buffermemory, the lists of buffer descriptors having respective priorities;and assigning the plurality of packets in the buffer memory to a bufferdescriptor in one of said plurality of lists of descriptors according tothe determined priority for transfer.
 87. The method according to claim86, wherein the descriptors identify memory locations accessible via thehost bus system for storage of the plurality of packets.
 88. The methodaccording to claim 84, further comprising: uploading the plurality ofpackets according to the determined priorities.
 89. The method accordingto claim 84, further comprising: performing a logic function based onthe accessed data fields and on the rule parameter that produces aresult; and using the result to deny or allow transfer of acorresponding packet.
 90. The method according to claim 84, furthercomprising: determining and storing a pointer to a data field within theplurality of respective packets in the buffer memory; and using thepointers to access data fields from the buffer memory.
 91. The methodaccording to claim 84, wherein said rule parameter includes rule dataand rule configuration values.
 92. The method according to claim 84,wherein said rule parameter includes configuration values indicating alocation of a field in the corresponding packet to be accessed.